local sk__juechen = fk.CreateSkill {

  name = "sk__juechen",

  tags = {  },

}



sk__juechen:addEffect(fk.DamageCaused, {
  name = "sk__juechen",
  anim_type = "offensive",
  events = {fk.DamageCaused},
  can_trigger = function(self, event, target, player, data)
    return target and target == player and player:hasSkill(sk__juechen.name) and data.to ~= player and not data.to.dead and
      data.card and data.card.trueName == "slash"
  end,
  on_cost = function(self, event, target, player, data)
    local choice = player.room:askForChoice(player, {"sk__juechen1::"..data.to.id..":"..data.damage,
      "sk__juechen2::"..data.to.id, "Cancel"}, sk__juechen.name, "#sk__juechen-invoke::"..data.to.id)
    if choice ~= "Cancel" then
      event:setCostData(self, choice[12])
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    if event:getCostData(self) == "1" then
      room:loseHp(data.to, data.damage, sk__juechen.name)
    else
      room:changeMaxHp(data.to, -1)
    end
    data:preventDamage()
  end,
})

return sk__juechen